package com.itheima.thread;

/**
 * @Author: Ethan Yankang
 * @Program: Interview
 * @Date: 2024-08-22 16:55
 **/
public class basic {
    public static void main(String[] args) throws InterruptedException {
        int count=0;

        new Thread(()->{
            int count1=0;
            while (true){
                System.out.println("这是线程"+Thread.currentThread().getName()+(count1++)+"次数");
                try {
                    Thread.sleep(100);
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }

        }).start();

        while (true){
            System.err.println("这是线程"+Thread.currentThread().getName()+"的工作--打印"+(count++)+"次数");
            Thread.sleep(100);
        }
    }
}
